def can_play(fn):
    def action(name, game, **kwargs):
        clock = kwargs.get('clock', 21)  # 最好别用kwargs['clock']，因为如果没传该参数将报错
        if clock >= 21:
            print('too late to play')
        else:
            fn(name, game)

    return action


@can_play
def play_game(name, game):
    print(name, 'play', game)


play_game('tom', 'game1', clock=20)
